import type {ReducerActionType} from "@/types/commonType.ts";
import type {LayoutStateType} from "@/types/layoutType.ts";

export const layoutReducer = (state: LayoutStateType, action: ReducerActionType) => {
    const {payload} = action
    switch (action.type) {
        case 'SET_COLLAPSIBLE':
            return {
                ...state,
                ...payload
            }
        case 'SET_DEFAULT_SELECTED_KEYS':
            return {
                ...state,
                ...payload
            }
        case 'SET_OPEN_KEYS':
            return {
                ...state,
                ...payload
            }
        default:
            return state
    }
}